3.421 \(\int (g+h x)^2 (a+b \log (c (d (e+f x)^p)^q)) \, dx\)

Optimal. Leaf size=128 \[ \frac{(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac{b p q x (f g-e h)^2}{3 f^2}-\frac{b p q (f g-e h)^3 \log (e+f x)}{3 f^3 h}-\frac{b p q (g+h x)^2 (f g-e h)}{6 f h}-\frac{b p q (g+h x)^3}{9 h} \]

[Out]

-(b*(f*g - e*h)^2*p*q*x)/(3*f^2) - (b*(f*g - e*h)*p*q*(g + h*x)^2)/(6*f*h) - (b*p*q*(g + h*x)^3)/(9*h) - (b*(f
*g - e*h)^3*p*q*Log[e + f*x])/(3*f^3*h) + ((g + h*x)^3*(a + b*Log[c*(d*(e + f*x)^p)^q]))/(3*h)

________________________________________________________________________________________

Rubi [A]  time = 0.125221, antiderivative size = 128, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.115, Rules used = {2395, 43, 2445} \[ \frac{(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac{b p q x (f g-e h)^2}{3 f^2}-\frac{b p q (f g-e h)^3 \log (e+f x)}{3 f^3 h}-\frac{b p q (g+h x)^2 (f g-e h)}{6 f h}-\frac{b p q (g+h x)^3}{9 h} \]

Antiderivative was successfully verified.

[In]

Int[(g + h*x)^2*(a + b*Log[c*(d*(e + f*x)^p)^q]),x]

[Out]

-(b*(f*g - e*h)^2*p*q*x)/(3*f^2) - (b*(f*g - e*h)*p*q*(g + h*x)^2)/(6*f*h) - (b*p*q*(g + h*x)^3)/(9*h) - (b*(f
*g - e*h)^3*p*q*Log[e + f*x])/(3*f^3*h) + ((g + h*x)^3*(a + b*Log[c*(d*(e + f*x)^p)^q]))/(3*h)

Rule 2395

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_))^(q_.), x_Symbol] :> Simp[((f + g
*x)^(q + 1)*(a + b*Log[c*(d + e*x)^n]))/(g*(q + 1)), x] - Dist[(b*e*n)/(g*(q + 1)), Int[(f + g*x)^(q + 1)/(d +
 e*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && NeQ[q, -1]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2445

Int[((a_.) + Log[(c_.)*((d_.)*((e_.) + (f_.)*(x_))^(m_.))^(n_)]*(b_.))^(p_.)*(u_.), x_Symbol] :> Subst[Int[u*(
a + b*Log[c*d^n*(e + f*x)^(m*n)])^p, x], c*d^n*(e + f*x)^(m*n), c*(d*(e + f*x)^m)^n] /; FreeQ[{a, b, c, d, e,
f, m, n, p}, x] &&  !IntegerQ[n] &&  !(EqQ[d, 1] && EqQ[m, 1]) && IntegralFreeQ[IntHide[u*(a + b*Log[c*d^n*(e
+ f*x)^(m*n)])^p, x]]

Rubi steps

\begin{align*} \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx &=\operatorname{Subst}\left (\int (g+h x)^2 \left (a+b \log \left (c d^q (e+f x)^{p q}\right )\right ) \, dx,c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac{(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\operatorname{Subst}\left (\frac{(b f p q) \int \frac{(g+h x)^3}{e+f x} \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac{(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\operatorname{Subst}\left (\frac{(b f p q) \int \left (\frac{h (f g-e h)^2}{f^3}+\frac{(f g-e h)^3}{f^3 (e+f x)}+\frac{h (f g-e h) (g+h x)}{f^2}+\frac{h (g+h x)^2}{f}\right ) \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=-\frac{b (f g-e h)^2 p q x}{3 f^2}-\frac{b (f g-e h) p q (g+h x)^2}{6 f h}-\frac{b p q (g+h x)^3}{9 h}-\frac{b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac{(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}\\ \end{align*}

Mathematica [A]  time = 0.179455, size = 156, normalized size = 1.22 \[ \frac{f \left (x \left (6 a f^2 \left (3 g^2+3 g h x+h^2 x^2\right )-b p q \left (6 e^2 h^2-3 e f h (6 g+h x)+f^2 \left (18 g^2+9 g h x+2 h^2 x^2\right )\right )\right )+6 b f \left (3 e g^2+f x \left (3 g^2+3 g h x+h^2 x^2\right )\right ) \log \left (c \left (d (e+f x)^p\right )^q\right )\right )+6 b e^2 h p q (e h-3 f g) \log (e+f x)}{18 f^3} \]

Antiderivative was successfully verified.

[In]

Integrate[(g + h*x)^2*(a + b*Log[c*(d*(e + f*x)^p)^q]),x]

[Out]

(6*b*e^2*h*(-3*f*g + e*h)*p*q*Log[e + f*x] + f*(x*(6*a*f^2*(3*g^2 + 3*g*h*x + h^2*x^2) - b*p*q*(6*e^2*h^2 - 3*
e*f*h*(6*g + h*x) + f^2*(18*g^2 + 9*g*h*x + 2*h^2*x^2))) + 6*b*f*(3*e*g^2 + f*x*(3*g^2 + 3*g*h*x + h^2*x^2))*L
og[c*(d*(e + f*x)^p)^q]))/(18*f^3)

________________________________________________________________________________________

Maple [F]  time = 0.497, size = 0, normalized size = 0. \begin{align*} \int \left ( hx+g \right ) ^{2} \left ( a+b\ln \left ( c \left ( d \left ( fx+e \right ) ^{p} \right ) ^{q} \right ) \right ) \, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((h*x+g)^2*(a+b*ln(c*(d*(f*x+e)^p)^q)),x)

[Out]

int((h*x+g)^2*(a+b*ln(c*(d*(f*x+e)^p)^q)),x)

________________________________________________________________________________________

Maxima [A]  time = 1.20534, size = 273, normalized size = 2.13 \begin{align*} -b f g^{2} p q{\left (\frac{x}{f} - \frac{e \log \left (f x + e\right )}{f^{2}}\right )} + \frac{1}{18} \, b f h^{2} p q{\left (\frac{6 \, e^{3} \log \left (f x + e\right )}{f^{4}} - \frac{2 \, f^{2} x^{3} - 3 \, e f x^{2} + 6 \, e^{2} x}{f^{3}}\right )} - \frac{1}{2} \, b f g h p q{\left (\frac{2 \, e^{2} \log \left (f x + e\right )}{f^{3}} + \frac{f x^{2} - 2 \, e x}{f^{2}}\right )} + \frac{1}{3} \, b h^{2} x^{3} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + \frac{1}{3} \, a h^{2} x^{3} + b g h x^{2} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g h x^{2} + b g^{2} x \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g^{2} x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="maxima")

[Out]

-b*f*g^2*p*q*(x/f - e*log(f*x + e)/f^2) + 1/18*b*f*h^2*p*q*(6*e^3*log(f*x + e)/f^4 - (2*f^2*x^3 - 3*e*f*x^2 +
6*e^2*x)/f^3) - 1/2*b*f*g*h*p*q*(2*e^2*log(f*x + e)/f^3 + (f*x^2 - 2*e*x)/f^2) + 1/3*b*h^2*x^3*log(((f*x + e)^
p*d)^q*c) + 1/3*a*h^2*x^3 + b*g*h*x^2*log(((f*x + e)^p*d)^q*c) + a*g*h*x^2 + b*g^2*x*log(((f*x + e)^p*d)^q*c)
+ a*g^2*x

________________________________________________________________________________________

Fricas [B]  time = 1.91144, size = 583, normalized size = 4.55 \begin{align*} -\frac{2 \,{\left (b f^{3} h^{2} p q - 3 \, a f^{3} h^{2}\right )} x^{3} - 3 \,{\left (6 \, a f^{3} g h -{\left (3 \, b f^{3} g h - b e f^{2} h^{2}\right )} p q\right )} x^{2} - 6 \,{\left (3 \, a f^{3} g^{2} -{\left (3 \, b f^{3} g^{2} - 3 \, b e f^{2} g h + b e^{2} f h^{2}\right )} p q\right )} x - 6 \,{\left (b f^{3} h^{2} p q x^{3} + 3 \, b f^{3} g h p q x^{2} + 3 \, b f^{3} g^{2} p q x +{\left (3 \, b e f^{2} g^{2} - 3 \, b e^{2} f g h + b e^{3} h^{2}\right )} p q\right )} \log \left (f x + e\right ) - 6 \,{\left (b f^{3} h^{2} x^{3} + 3 \, b f^{3} g h x^{2} + 3 \, b f^{3} g^{2} x\right )} \log \left (c\right ) - 6 \,{\left (b f^{3} h^{2} q x^{3} + 3 \, b f^{3} g h q x^{2} + 3 \, b f^{3} g^{2} q x\right )} \log \left (d\right )}{18 \, f^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="fricas")

[Out]

-1/18*(2*(b*f^3*h^2*p*q - 3*a*f^3*h^2)*x^3 - 3*(6*a*f^3*g*h - (3*b*f^3*g*h - b*e*f^2*h^2)*p*q)*x^2 - 6*(3*a*f^
3*g^2 - (3*b*f^3*g^2 - 3*b*e*f^2*g*h + b*e^2*f*h^2)*p*q)*x - 6*(b*f^3*h^2*p*q*x^3 + 3*b*f^3*g*h*p*q*x^2 + 3*b*
f^3*g^2*p*q*x + (3*b*e*f^2*g^2 - 3*b*e^2*f*g*h + b*e^3*h^2)*p*q)*log(f*x + e) - 6*(b*f^3*h^2*x^3 + 3*b*f^3*g*h
*x^2 + 3*b*f^3*g^2*x)*log(c) - 6*(b*f^3*h^2*q*x^3 + 3*b*f^3*g*h*q*x^2 + 3*b*f^3*g^2*q*x)*log(d))/f^3

________________________________________________________________________________________

Sympy [A]  time = 9.84703, size = 342, normalized size = 2.67 \begin{align*} \begin{cases} a g^{2} x + a g h x^{2} + \frac{a h^{2} x^{3}}{3} + \frac{b e^{3} h^{2} p q \log{\left (e + f x \right )}}{3 f^{3}} - \frac{b e^{2} g h p q \log{\left (e + f x \right )}}{f^{2}} - \frac{b e^{2} h^{2} p q x}{3 f^{2}} + \frac{b e g^{2} p q \log{\left (e + f x \right )}}{f} + \frac{b e g h p q x}{f} + \frac{b e h^{2} p q x^{2}}{6 f} + b g^{2} p q x \log{\left (e + f x \right )} - b g^{2} p q x + b g^{2} q x \log{\left (d \right )} + b g^{2} x \log{\left (c \right )} + b g h p q x^{2} \log{\left (e + f x \right )} - \frac{b g h p q x^{2}}{2} + b g h q x^{2} \log{\left (d \right )} + b g h x^{2} \log{\left (c \right )} + \frac{b h^{2} p q x^{3} \log{\left (e + f x \right )}}{3} - \frac{b h^{2} p q x^{3}}{9} + \frac{b h^{2} q x^{3} \log{\left (d \right )}}{3} + \frac{b h^{2} x^{3} \log{\left (c \right )}}{3} & \text{for}\: f \neq 0 \\\left (a + b \log{\left (c \left (d e^{p}\right )^{q} \right )}\right ) \left (g^{2} x + g h x^{2} + \frac{h^{2} x^{3}}{3}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)**2*(a+b*ln(c*(d*(f*x+e)**p)**q)),x)

[Out]

Piecewise((a*g**2*x + a*g*h*x**2 + a*h**2*x**3/3 + b*e**3*h**2*p*q*log(e + f*x)/(3*f**3) - b*e**2*g*h*p*q*log(
e + f*x)/f**2 - b*e**2*h**2*p*q*x/(3*f**2) + b*e*g**2*p*q*log(e + f*x)/f + b*e*g*h*p*q*x/f + b*e*h**2*p*q*x**2
/(6*f) + b*g**2*p*q*x*log(e + f*x) - b*g**2*p*q*x + b*g**2*q*x*log(d) + b*g**2*x*log(c) + b*g*h*p*q*x**2*log(e
 + f*x) - b*g*h*p*q*x**2/2 + b*g*h*q*x**2*log(d) + b*g*h*x**2*log(c) + b*h**2*p*q*x**3*log(e + f*x)/3 - b*h**2
*p*q*x**3/9 + b*h**2*q*x**3*log(d)/3 + b*h**2*x**3*log(c)/3, Ne(f, 0)), ((a + b*log(c*(d*e**p)**q))*(g**2*x +
g*h*x**2 + h**2*x**3/3), True))

________________________________________________________________________________________

Giac [B]  time = 1.19275, size = 790, normalized size = 6.17 \begin{align*} \frac{{\left (f x + e\right )} b g^{2} p q \log \left (f x + e\right )}{f} + \frac{{\left (f x + e\right )}^{2} b g h p q \log \left (f x + e\right )}{f^{2}} + \frac{{\left (f x + e\right )}^{3} b h^{2} p q \log \left (f x + e\right )}{3 \, f^{3}} - \frac{2 \,{\left (f x + e\right )} b g h p q e \log \left (f x + e\right )}{f^{2}} - \frac{{\left (f x + e\right )}^{2} b h^{2} p q e \log \left (f x + e\right )}{f^{3}} - \frac{{\left (f x + e\right )} b g^{2} p q}{f} - \frac{{\left (f x + e\right )}^{2} b g h p q}{2 \, f^{2}} - \frac{{\left (f x + e\right )}^{3} b h^{2} p q}{9 \, f^{3}} + \frac{2 \,{\left (f x + e\right )} b g h p q e}{f^{2}} + \frac{{\left (f x + e\right )}^{2} b h^{2} p q e}{2 \, f^{3}} + \frac{{\left (f x + e\right )} b h^{2} p q e^{2} \log \left (f x + e\right )}{f^{3}} + \frac{{\left (f x + e\right )} b g^{2} q \log \left (d\right )}{f} + \frac{{\left (f x + e\right )}^{2} b g h q \log \left (d\right )}{f^{2}} + \frac{{\left (f x + e\right )}^{3} b h^{2} q \log \left (d\right )}{3 \, f^{3}} - \frac{2 \,{\left (f x + e\right )} b g h q e \log \left (d\right )}{f^{2}} - \frac{{\left (f x + e\right )}^{2} b h^{2} q e \log \left (d\right )}{f^{3}} - \frac{{\left (f x + e\right )} b h^{2} p q e^{2}}{f^{3}} + \frac{{\left (f x + e\right )} b g^{2} \log \left (c\right )}{f} + \frac{{\left (f x + e\right )}^{2} b g h \log \left (c\right )}{f^{2}} + \frac{{\left (f x + e\right )}^{3} b h^{2} \log \left (c\right )}{3 \, f^{3}} - \frac{2 \,{\left (f x + e\right )} b g h e \log \left (c\right )}{f^{2}} - \frac{{\left (f x + e\right )}^{2} b h^{2} e \log \left (c\right )}{f^{3}} + \frac{{\left (f x + e\right )} b h^{2} q e^{2} \log \left (d\right )}{f^{3}} + \frac{{\left (f x + e\right )} a g^{2}}{f} + \frac{{\left (f x + e\right )}^{2} a g h}{f^{2}} + \frac{{\left (f x + e\right )}^{3} a h^{2}}{3 \, f^{3}} - \frac{2 \,{\left (f x + e\right )} a g h e}{f^{2}} - \frac{{\left (f x + e\right )}^{2} a h^{2} e}{f^{3}} + \frac{{\left (f x + e\right )} b h^{2} e^{2} \log \left (c\right )}{f^{3}} + \frac{{\left (f x + e\right )} a h^{2} e^{2}}{f^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="giac")

[Out]

(f*x + e)*b*g^2*p*q*log(f*x + e)/f + (f*x + e)^2*b*g*h*p*q*log(f*x + e)/f^2 + 1/3*(f*x + e)^3*b*h^2*p*q*log(f*
x + e)/f^3 - 2*(f*x + e)*b*g*h*p*q*e*log(f*x + e)/f^2 - (f*x + e)^2*b*h^2*p*q*e*log(f*x + e)/f^3 - (f*x + e)*b
*g^2*p*q/f - 1/2*(f*x + e)^2*b*g*h*p*q/f^2 - 1/9*(f*x + e)^3*b*h^2*p*q/f^3 + 2*(f*x + e)*b*g*h*p*q*e/f^2 + 1/2
*(f*x + e)^2*b*h^2*p*q*e/f^3 + (f*x + e)*b*h^2*p*q*e^2*log(f*x + e)/f^3 + (f*x + e)*b*g^2*q*log(d)/f + (f*x +
e)^2*b*g*h*q*log(d)/f^2 + 1/3*(f*x + e)^3*b*h^2*q*log(d)/f^3 - 2*(f*x + e)*b*g*h*q*e*log(d)/f^2 - (f*x + e)^2*
b*h^2*q*e*log(d)/f^3 - (f*x + e)*b*h^2*p*q*e^2/f^3 + (f*x + e)*b*g^2*log(c)/f + (f*x + e)^2*b*g*h*log(c)/f^2 +
 1/3*(f*x + e)^3*b*h^2*log(c)/f^3 - 2*(f*x + e)*b*g*h*e*log(c)/f^2 - (f*x + e)^2*b*h^2*e*log(c)/f^3 + (f*x + e
)*b*h^2*q*e^2*log(d)/f^3 + (f*x + e)*a*g^2/f + (f*x + e)^2*a*g*h/f^2 + 1/3*(f*x + e)^3*a*h^2/f^3 - 2*(f*x + e)
*a*g*h*e/f^2 - (f*x + e)^2*a*h^2*e/f^3 + (f*x + e)*b*h^2*e^2*log(c)/f^3 + (f*x + e)*a*h^2*e^2/f^3